
#import "LBSplashViewController.h"
#import <LbAdSdk/ADv.h>
#import "Config.h"

@interface LBSplashViewController () <SplashDelegate>
@property (nonatomic, strong) SplashAD* splashAD;
@end

@implementation LBSplashViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self showAD];
}

- (UIWindow *)getCurWindow{
    UIWindow *mainWindow = nil;
    if ( @available(iOS 13.0, *) ) {
        mainWindow = [UIApplication sharedApplication].windows.firstObject;
        [mainWindow makeKeyWindow];
    }else {
        mainWindow = [UIApplication sharedApplication].keyWindow;
    }
    return mainWindow;
}

- (void)showAD{
    _splashAD = [ADv showSp:LB_TEST_SP_ID containerView:[self getCurWindow] delegate:self];
}

- (void)reloadAD{
    [_splashAD reload];
}

// MARK:- loading

- (void)didFailToLoadADWithPlacementID:(NSString *)placementID error:(NSError *)error {
    NSLog(@"LBSplashViewController::didFailToLoadADWithPlacementID:%@ error:%@",placementID,error);
}

- (void)didFinishLoadingADWithPlacementID:(NSString *)placementID {
    NSLog(@"LBSplashViewController::didFinishLoadingADWithPlacementID:%@",placementID);
}
// MARK:- splash delegate
- (void)splashDidClickForPlacementID:(NSString *)placementID extra:(NSDictionary *)extra {
    NSLog(@"LBSplashViewController::splashDidClickForPlacementID:%@ extra:%@",placementID,extra);
}

- (void)splashDidCloseForPlacementID:(NSString *)placementID extra:(NSDictionary *)extra {
    NSLog(@"LBSplashViewController::splashDidCloseForPlacementID:%@ extra:%@",placementID,extra);
}

- (void)splashDidShowForPlacementID:(NSString *)placementID extra:(NSDictionary *)extra {
    NSLog(@"LBSplashViewController::splashDidShowForPlacementID:%@ extra:%@",placementID,extra);
}

-(void)splashZoomOutViewDidClickForPlacementID:(NSString*)placementID extra:(NSDictionary *) extra {
    NSLog(@"LBSplashViewController::splashZoomOutViewDidClickForPlacementID:%@ extra:%@",placementID,extra);
}

-(void)splashZoomOutViewDidCloseForPlacementID:(NSString*)placementID extra:(NSDictionary *) extra {
    NSLog(@"LBSplashViewController::splashZoomOutViewDidCloseForPlacementID:%@ extra:%@",placementID,extra);
}

- (void)splashDetailDidClosedForPlacementID:(NSString*)placementID extra:(NSDictionary *) extra {
    NSLog(@"LBSplashViewController::splashDetailDidClosedForPlacementID:%@ extra:%@",placementID,extra);
}

- (void)splashDidShowFailedForPlacementID:(NSString*)placementID error:(NSError *)error extra:(NSDictionary *) extra {
    NSLog(@"LBSplashViewController::splashDidShowFailedForPlacementID:%@ error:%@ extra:%@",placementID,error,extra);
}


@end
